"""
World scene.
"""

import mjin2
from GameObject import *
from SceneSerializer import *

class GameScene(GameObject):
    def __init__(self, world, fileName):
        super(GameScene, self).__init__(world.pathResolver)
        self.world = world
        self.scene = mjin2.Scene()
        self.sceneNodeFactory = mjin2.SceneNodeFactory()
        self.sceneSerializer = SceneSerializer(world.pathResolver, self.sceneNodeFactory)
        self.load(fileName)
    def finish(self):
        print "Finishing the scene {0}".format(self.name)
        super(GameScene, self).finish()
    def load(self, fileName):
        self.name = fileName
        fileName = self.pathResolver.findFile(fileName)
        print "Loading scene: {0}".format(fileName)
        self.sceneSerializer.load(self, fileName)
        print "Finished loading scene: {0}".format(fileName)
    def start(self):
        print "Scene: starting {0}. Addr: {1}".format(self.name, super(GameScene, self).start)
        super(GameScene, self).start()
